<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :exportApiName="exportApiName"
                :saveAuthName="saveAuthName"
                :deleteAuthName="deleteAuthName"
                :showAttrs="showAttrs"
                :optionWidth="150"
                :sumInfo='sumInfo'
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>


<script>
import tableView from '@/components/tableView'
import basicMixins from '@/utils/commonViewMixins'
import AddOrUpdate from './financetransactionproduct-add-or-update'

export default {
  mixins: [basicMixins],
  data() {
    return {
      primaryKey: 'id',
      listApiName: 'financeApi/listFinanceTransactionProduct',
      deleteApiName: 'financeApi/deleteFinanceTransactionProduct',
      exportApiName: 'financeApi/getFinanceTransactionProductExport',
      saveAuthName: 'finance:financetransactionproduct:save',
      deleteAuthName: 'finance:financetransactionproduct:delete',
      searchAttrs: {
        clientContractNo: {
          label: '合同编号',
          placeholder: '请输入合同编号',
        },
        clientId: {
          label: '客户名称',
          clearable: true,
          type: 'autoComplete',
          placeholder: '请输入客户名称',
          querySearchApiName: 'clientApi/getClientList'
        },
        dateTimeRange:{
          type: 'date',
          dateType: 'daterange',
          clearable: true
        },
      },
      sumInfo: {realSaleNumber: 'realSaleNumber',discountTotalPrice: 'discountTotalPrice', receiveReduceAmount: 'receiveReduceAmount'},
      showAttrs: {
        dayTime: {
          label: '日期',
          type: 'date',
          width:130
        },
        clientContractNo: {
          label: '客户合同编号',
          width: 150
        },
        productNo: {
          label: '货物名称',
          width:180
        },
        // productWeight: {
        //   label: '克重'
        // },
        realSaleNumber: {
          label: '销售数量'
        },
        // unitPrice: {
        //   label: '单价'
        // },
        // totalPrice: {
        //   label: '金额',
        //   width: 120
        // },
        // discount: {
        //   label: '折扣'
        // },
        // discountUnitPrice: {
        //   label: '折后单价'
        // },
        discountTotalPrice: {
          label: '应收增加',
          width: 120
        },
        receiveReduceAmount: {
          label: '应收减少',
          width: 120
        },

        balanceReceivableAmount: {
          label: '应收余额',
          width: 120
        },
        clientName: {
          label: '客户名称',
          width: 120
        },
        transactionType: {
          label: '往来类别',
          type: 'radio',
          items: [
            {value: '应收增加', text: '应收增加', tagType: 'success'},
            {value: '应收减少', text: '应收减少', tagType: 'danger'},
          ],
          width: 110
        },
        openingBalanceAmount: {
          label: '期初金额',
          width: 120
        },
        saleName: {
          label: '业务员',
          width: 120
        },
        // boxZhiNumber: {label: '箱只'},
        // boxNumber: {label: '箱数'},
        //  trayInfoNo: {label: '托盘编号'},
        // trayLayerNumber: {label: '托盘层数'},
        // trayEachZhiNumber: {label: '托盘每层支数'},
        // scrapNumber: {label: '零头'},
        // orderDetailNo: {
        //   label: '订单编号',
        //   width: 110
        // },
        // productLeaveStorageNo: {
        //   label: '出库单编号',
        //   width: 110
        // },

        remark: {
          label: '备注'
        },
        additionalRemark: {
          label: '附加说明'
        },

        // status: {
        //   label: '状态'
        // }
      }
    }
  },
  components: {
    tableView,
    AddOrUpdate
  }
}
</script>
